﻿namespace SUNRPA.CONTROLS.IMPL.domain.flowItemParam {
    [Serializable]
    public class SetWebDDLNParam : BaseParam {
        private string webObj = "{webPage}";
        private string selectValue;
        private Element webEle;
    
        //0按内容选择，1按位置选择
        private int selectType = 0;
        //等待元素存在（s）
        private int waitEleTime = 20;
        //0模糊匹配，1精确匹配，2正则匹配
        private int matchMethod = 0;
        private string delayTime = "1";

        public string DelayTime {
            get => delayTime;
            set {
                delayTime = value;
                NotifyPropertyChanged("DelayTime");
            }
        }

        public string GetTranslateSelectType() {
            switch(this.selectType) {
                case 0:
                    return $"按内容{this.GetTranslateMatchMethod()}选择{selectValue}作为下拉框的值";
                case 1:
                    return $"按位置选择第{selectValue}个选项作为下拉框的值";
                default : return "按内容选择";
            }
        }
        public string GetTranslateMatchMethod() {
            switch(this.selectType) {
                case 0:
                    return "模糊匹配";
                case 1:
                    return "精确匹配";
                case 2:
                    return "正则匹配";
                default : return "模糊匹配";
            }
        }

        public int MatchMethod {
            get => matchMethod; 
            set { 
                matchMethod = value;
                NotifyPropertyChanged("MatchMethod");
            }  
        }

        public string SelectValue {
            get => selectValue;
            set {
                selectValue = value;
                NotifyPropertyChanged("SelectValue");
            }
        }

        public int WaitEleTime {
            get => waitEleTime; 
            set { 
                waitEleTime = value;
                NotifyPropertyChanged("WaitEleTime");
            }  
        }
        public int SelectType { 
            get => selectType;
            set { 
                selectType = value; 
                NotifyPropertyChanged("SelectType");
            }
        }
        public string WebObj {
            get => webObj;
            set {
                webObj = value;
                NotifyPropertyChanged("WebObj");
            }
        }

        public Element WebEle {
            get => webEle;
            set {
                webEle = value;
                NotifyPropertyChanged("WebEle");
            }
        }
    }
}
